home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 July: Mac OS SDK / Dev.CD Jul 00 SDK2.toast / Development Kits / Hardware / PowerManager DDK 1.0f1 / Interfaces&Libraries / Interfaces / Power.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-10-11  |  46.6 KB  |  1,164 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Power.h
  3.  
  4.      Contains:    Power Manager Interfaces.
  5.  
  6.      Version:    System 7.5
  7.  
  8.      DRI:        Scott Johnson
  9.  
  10.      Copyright:    © 1990-1999 by Apple Computer, Inc.  All rights reserved
  11.  
  12.      Warning:    *** APPLE INTERNAL USE ONLY ***
  13.                  This file may contain unreleased API's
  14.  
  15.      BuildInfo:    Built by:            Scott Johnson
  16.                  On:                    10/11/99 6:23 PM
  17.                  With Interfacer:    3.0d13   (MPW PowerPC)
  18.                  From:                Power.i
  19.                      Revision:        89
  20.                      Dated:            10/8/99
  21.                      Last change by:    SAJ
  22.                      Last comment:    Commit APPLE_ONLY_UNTIL_CORE99.
  23.  
  24.      Bugs:        Report bugs to Radar component "System Interfaces", "Latest"
  25.                  List the version information (from above) in the Problem Description.
  26.  
  27. */
  28. #ifndef __POWER__
  29. #define __POWER__
  30.  
  31. #ifndef __MACTYPES__
  32. #include <MacTypes.h>
  33. #endif
  34.  
  35. #ifndef __MIXEDMODE__
  36. #include <MixedMode.h>
  37. #endif
  38.  
  39. #ifndef __MULTIPROCESSING__
  40. #include <Multiprocessing.h>
  41. #endif
  42.  
  43. #ifndef __NAMEREGISTRY__
  44. #include <NameRegistry.h>
  45. #endif
  46.  
  47.  
  48.  
  49.  
  50. #if PRAGMA_ONCE
  51. #pragma once
  52. #endif
  53.  
  54. #ifdef __cplusplus
  55. extern "C" {
  56. #endif
  57.  
  58. #if PRAGMA_IMPORT
  59. #pragma import on
  60. #endif
  61.  
  62. #if PRAGMA_STRUCT_ALIGN
  63.     #pragma options align=mac68k
  64. #elif PRAGMA_STRUCT_PACKPUSH
  65.     #pragma pack(push, 2)
  66. #elif PRAGMA_STRUCT_PACK
  67.     #pragma pack(2)
  68. #endif
  69.  
  70. enum {
  71.                                                                 /* Bit positions for ModemByte */
  72.     modemOnBit                    = 0,
  73.     ringWakeUpBit                = 2,
  74.     modemInstalledBit            = 3,
  75.     ringDetectBit                = 4,
  76.     modemOnHookBit                = 5
  77. };
  78.  
  79. enum {
  80.                                                                 /* masks for ModemByte */
  81.     modemOnMask                    = 0x01,
  82.     ringWakeUpMask                = 0x04,
  83.     modemInstalledMask            = 0x08,
  84.     ringDetectMask                = 0x10,
  85.     modemOnHookMask                = 0x20
  86. };
  87.  
  88. enum {
  89.                                                                 /* bit positions for BatteryByte */
  90.     chargerConnBit                = 0,
  91.     hiChargeBit                    = 1,
  92.     chargeOverFlowBit            = 2,
  93.     batteryDeadBit                = 3,
  94.     batteryLowBit                = 4,
  95.     connChangedBit                = 5
  96. };
  97.  
  98. enum {
  99.                                                                 /* masks for BatteryByte */
  100.     chargerConnMask                = 0x01,
  101.     hiChargeMask                = 0x02,
  102.     chargeOverFlowMask            = 0x04,
  103.     batteryDeadMask                = 0x08,
  104.     batteryLowMask                = 0x10,
  105.     connChangedMask                = 0x20
  106. };
  107.  
  108. enum {
  109.                                                                 /* bit positions for SoundMixerByte */
  110.     MediaBaySndEnBit            = 0,
  111.     PCISndEnBit                    = 1,
  112.     ZVSndEnBit                    = 2,
  113.     PCCardSndEnBit                = 3
  114. };
  115.  
  116. enum {
  117.                                                                 /* masks for SoundMixerByte */
  118.     MediaBaySndEnMask            = 0x01,
  119.     PCISndEnMask                = 0x02,
  120.     ZVSndEnMask                    = 0x04,
  121.     PCCardSndEnMask                = 0x08
  122. };
  123.  
  124. enum {
  125.                                                                 /* commands to SleepQRec sleepQProc */
  126.     kSleepRequest                = 1,
  127.     kSleepDemand                = 2,
  128.     kSleepWakeUp                = 3,
  129.     kSleepRevoke                = 4,
  130.     kSleepUnlock                = 4,
  131.     kSleepDeny                    = 5,
  132.     kSleepNow                    = 6,
  133.     kDozeDemand                    = 7,
  134.     kDozeWakeUp                    = 8,
  135.     kDozeRequest                = 9,                            /* additional messages for Power Mgr 2.0*/
  136.     kEnterStandby                = 10,
  137.     kEnterRun                    = 11,
  138.     kSuspendRequest                = 12,
  139.     kSuspendDemand                = 13,
  140.     kSuspendRevoke                = 14,
  141.     kSuspendWakeUp                = 15,
  142.     kGetPowerLevel                = 16,
  143.     kSetPowerLevel                = 17,
  144.     kDeviceInitiatedWake        = 18,
  145.     kWakeToDoze                    = 19,
  146.     kDozeToFullWakeUp            = 20,
  147.     kGetPowerInfo                = 21,
  148.     kGetWakeOnNetInfo            = 22
  149. };
  150.  
  151. enum {
  152.                                                                 /* depreciated commands to SleepQRec sleepQProc */
  153.     sleepRequest                = kSleepRequest,
  154.     sleepDemand                    = kSleepDemand,
  155.     sleepWakeUp                    = kSleepWakeUp,
  156.     sleepRevoke                    = kSleepRevoke,
  157.     sleepUnlock                    = kSleepUnlock,
  158.     sleepDeny                    = kSleepDeny,
  159.     sleepNow                    = kSleepNow,
  160.     dozeDemand                    = kDozeDemand,
  161.     dozeWakeUp                    = kDozeWakeUp,
  162.     dozeRequest                    = kDozeRequest,
  163.     enterStandby                = kEnterStandby,
  164.     enterRun                    = kEnterRun,
  165.     suspendRequestMsg            = kSuspendRequest,
  166.     suspendDemandMsg            = kSuspendDemand,
  167.     suspendRevokeMsg            = kSuspendRevoke,
  168.     suspendWakeUpMsg            = kSuspendWakeUp,
  169.     getPowerLevel                = kGetPowerLevel,
  170.     setPowerLevel                = kSetPowerLevel
  171. };
  172.  
  173. /* Power Handler func messages */
  174. typedef UInt32                             PowerLevel;
  175. /* Power levels corresponding to PCI Bus Power Management Interface Spec (PMIS) */
  176. enum {
  177.     kPMDevicePowerLevel_On        = 0,                            /* fully-powered 'On' state (D0 state)    */
  178.     kPMDevicePowerLevel_D1        = 1,                            /* not used by Apple system SW            */
  179.     kPMDevicePowerLevel_D2        = 2,                            /* not used by Apple system SW            */
  180.     kPMDevicePowerLevel_Off        = 3                                /* main PCI bus power 'Off', but PCI standby power available (D3cold state) */
  181. };
  182.  
  183. /* PowerHandlerProc definition */
  184. typedef CALLBACK_API( OSStatus , PowerHandlerProcPtr )(UInt32 message, void *param, UInt32 refCon, RegEntryID *regEntryID);
  185. typedef STACK_UPP_TYPE(PowerHandlerProcPtr)                     PowerHandlerUPP;
  186. #if OPAQUE_UPP_TYPES
  187.     EXTERN_API(PowerHandlerUPP)
  188.     NewPowerHandlerUPP               (PowerHandlerProcPtr        userRoutine);
  189.  
  190.     EXTERN_API(void)
  191.     DisposePowerHandlerUPP           (PowerHandlerUPP            userUPP);
  192.  
  193.     EXTERN_API(OSStatus)
  194.     InvokePowerHandlerUPP           (UInt32                    message,
  195.                                     void *                    param,
  196.                                     UInt32                    refCon,
  197.                                     RegEntryID *            regEntryID,
  198.                                     PowerHandlerUPP            userUPP);
  199.  
  200. #else
  201.     enum { uppPowerHandlerProcInfo = 0x00003FF0 };                     /* pascal 4_bytes Func(4_bytes, 4_bytes, 4_bytes, 4_bytes) */
  202.     #define NewPowerHandlerUPP(userRoutine)                         (PowerHandlerUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppPowerHandlerProcInfo, GetCurrentArchitecture())
  203.     #define DisposePowerHandlerUPP(userUPP)                         DisposeRoutineDescriptor(userUPP)
  204.     #define InvokePowerHandlerUPP(message, param, refCon, regEntryID, userUPP)  CALL_FOUR_PARAMETER_UPP((userUPP), uppPowerHandlerProcInfo, (message), (param), (refCon), (regEntryID))
  205. #endif
  206. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  207. #define NewPowerHandlerProc(userRoutine)                         NewPowerHandlerUPP(userRoutine)
  208. #define CallPowerHandlerProc(userRoutine, message, param, refCon, regEntryID) InvokePowerHandlerUPP(message, param, refCon, regEntryID, userRoutine)
  209. /* DriverPowerCapabilities struct */
  210. /*
  211.    The DriverPowerCapabilities structure is used only by PPC native drivers (ndrv).
  212.    A native driver will export this structure like it currently does now when
  213.    exporting a DriverDescription structure (e.g. TheDriverDescription).
  214.    The well-defined export that will be exported must be called: TheDriverPowerCapabilities
  215.    IMPORTANT NOTE:    ALL native drivers that match to their respective PCI
  216.                       slot devices MUST signify to the Power Manager that
  217.                       they can recover their device functionality after
  218.                       waking from Sleep with PCI bus power removed.
  219.                       If ANY PCI slot driver has not been updated and fails
  220.                       to indicate to the Power Manager that it can recover
  221.                       after PCI bus power is restored, then PCI bus power
  222.                       will NOT be removed during Sleep.  Without the ability
  223.                       to remove PCI bus power, the ability to switch the main
  224.                       power supply on some CPUs to a very-low power state
  225.                       will be unavailable to the System.
  226.    The PowerCapsFlags are used to determine:
  227.       - if a PCI slot device can recover from PCI power removal during Sleep.
  228.         Drivers should set the 'kDevicePowerCanBeRemovedForSleep' bit if true.
  229.           ***  ALL PCI slot device drivers must set this bit in order    ***
  230.           ***  that PCI bus power is allowed to be removed during Sleep. ***
  231.       - if the driver overrides the device's PCI Config space for determining
  232.         how much Standby (e.g. 3.3V Aux pin) power is used during Sleep.
  233.         Drivers should set the 'kDriverSpecifiesStandbyPower' bit only if the
  234.         device’s PCI Config values are known to be corrupted or do not specify
  235.         the Standby power consumed during D3cold.
  236.           If 'kDriverSpecifiesStandbyPower' bit is set:
  237.             - the 'kDeviceCanGeneratePMEDuringSleep' bit should be set if
  238.               the PCI slot device is able to use standby (3.3V Aux) power
  239.               to assert the PME signal during Sleep..
  240.             - the 'powerCapsStandbyPowerMilliWatts' field is used to specify
  241.               how much Standby power is needed.  This value is only used
  242.               if both the 'kDriverSpecifiesStandbyPower' and
  243.               'kDeviceCanGeneratePMEDuringSleep' bits are set.
  244.       - the method of support chosen by the driver for implementing the Power
  245.         handler mechanism:
  246.           If 'kDriverPowerMgtAware' is set, then the driver supports the Power
  247.           Handler mechanism which exists in the new Power Manager (v2.0 and later).
  248.           If 'kDriverPowerMgtUnderExpertControl' is set, then the Power Manager
  249.           will assume that the driver's Expert/Manager will communicate with the
  250.           driver's Power handler and the 'kDriverHasPowerHandlerExport bit'
  251.           will be ignored.
  252.           If 'kDriverHasPowerHandlerExport' is set, then the driver must export
  253.           a well-defined Power handler entry point called:
  254.               DoDriverPowerManagement
  255.           If this bit is not set and the 'kDriverPowerMgtAware' is set, then the
  256.           device must support Power handling within its DoDriverIO entry point.
  257.           Drivers that implement a DoDriverIO entry point will receive
  258.           IO Control and Status selectors that are defined in Devices.h.
  259.           Drivers that elect to export a "DoDriverPowerManagement" entry point should
  260.           set up the entry point as follows:
  261.               OSStatus
  262.               DoDriverPowerManagement( UInt32                message,
  263.                                        PowerLevel             *powerLevel,
  264.                                        UInt32                 refCon,
  265.                                        RegEntryIDPtr         regEntryID);
  266.           "DoDriverPowerManagement" entry points have the same parameters and expected
  267.           behavior as a Power handler that has been explicitly registered via the
  268.           Driver Services API "AddDevicePowerHandler"; the difference is that,
  269.           during system startup, the Power Manager will automatically register the
  270.           "DoDriverPowerManagement" entry point found within each driver.
  271. */
  272.  
  273. /* Used in DriverPowerCapabilities*/
  274. typedef UInt32                             PowerCapsVersion;
  275. enum {
  276.     kVersionOnePowerCapabilities = 1
  277. };
  278.  
  279. typedef OptionBits                         PowerCapsFlags;
  280. enum {
  281.     kDevicePowerCanBeRemovedForSleep = 0x00000001,                /* only remove PCI power when every device has this bit set */
  282.     kDriverSpecifiesStandbyPower = 0x00000002,                    /* set when driver overrides PCI device Config values */
  283.     kDeviceCanGeneratePMEDuringSleep = 0x00000004,                /* 3.3V standby power can be used to assert the PME# */
  284.     kDriverPowerMgtAware        = 0x00000008,                    /* new Power handler mechanism is supported */
  285.     kDriverPowerMgtUnderExpertControl = 0x00000010,                /* Expert or Manager will call the driver's Power handler */
  286.     kDriverHasPowerHandlerExport = 0x00000020                    /* Type of Power handler entry point: only set this bit if the */
  287. };
  288.  
  289. /*     driver exports a "DevicePowerManagement" entry point */
  290. /*
  291.    A device reliability issue arises when a device is subjected to shortened power
  292.    cycling intervals.  The new Power Manager allows a device to specify a minimum
  293.    value (in seconds) that a device must be powered on before being powered off.
  294.    The system has a default value of around 5 minutes (300 seconds).  If 5 minutes
  295.    is sufficient for a device, then use the following constant within DriverPowerCapabilities.
  296. */
  297. enum {
  298.     kUseDefaultWakeTime            = 0                                /* used when the system's default is sufficient */
  299. };
  300.  
  301. /*
  302.    This structure describes a device’s power capabilities as well as general Power Management support.
  303.       Note: powerCapsMinimumWakeTimeSeconds can be specified as kUseDefaultWakeTime
  304.       if the system's default time interval - 5 minutes - is sufficient.
  305. */
  306.  
  307. struct DriverPowerCapabilities {
  308.     PowerCapsVersion                 powerCapsVersion;            /* Version of this data structure */
  309.     PowerCapsFlags                     powerCapsFlags;                /* Power Management support characteristics */
  310.     UInt32                             powerCapsStandbyPowerMilliWatts; /* Power consumed during PCI bus sleep, 0 if none */
  311.     UInt32                             powerCapsMinimumWakeTimeSeconds; /* Safe time interval between removing and */
  312.                                                                 /*   restoring power to this device */
  313. };
  314. typedef struct DriverPowerCapabilities    DriverPowerCapabilities;
  315. typedef DriverPowerCapabilities *        DriverPowerCapabilitiesPtr;
  316. /* PCI power management support*/
  317. enum {
  318.     kUseDefaultMinimumWakeTime    = 0,                            /* Defaults to 5 minutes*/
  319.     kPowerSummaryVersion        = 1,                            /* Version of PowerSummary structure.*/
  320.     kDevicePowerInfoVersion        = 1                                /* Version of DevicePowerInfo structure.*/
  321. };
  322.  
  323. enum {
  324.                                                                 /* PowerSummary flags*/
  325.     kPCIPowerOffAllowed            = (1L << 0)                        /* PCI power off is allowed.*/
  326. };
  327.  
  328. enum {
  329.                                                                 /* DevicePowerInfo flags*/
  330.     kDevicePCIPowerOffAllowed    = (1L << 0),                    /* PCI power off is allowed for device.*/
  331.     kDeviceSupportsPMIS            = (1L << 1),                    /* Device supports Power Mgt Interface Spec.*/
  332.     kDeviceCanAssertPMEDuringSleep = (1L << 2),                    /* Device can assert PME# during sleep.*/
  333.     kDeviceUsesCommonLogicPower    = (1L << 3),                    /* Device uses common-logic power*/
  334.     kDeviceDriverPresent        = (1L << 4),                    /* Driver present for device.*/
  335.     kDeviceDriverSupportsPowerMgt = (1L << 5)                    /* Driver installed a power handler.*/
  336. };
  337.  
  338.  
  339. struct DevicePowerInfo {
  340.     UInt32                             version;                    /* Version of this structure.*/
  341.     RegEntryID                         regID;                        /* RegEntryID for device.*/
  342.     OptionBits                         flags;                        /* Flags*/
  343.     UInt32                             minimumWakeTime;            /* Minimum seconds before sleeping again.*/
  344.     UInt32                             sleepPowerNeeded;            /* Milliwatts needed in the sleep state.*/
  345. };
  346. typedef struct DevicePowerInfo            DevicePowerInfo;
  347.  
  348. struct PowerSummary {
  349.     UInt32                             version;                    /* Version of this structure.*/
  350.     OptionBits                         flags;                        /* Flags*/
  351.     UInt32                             sleepPowerAvailable;        /* Milliwatts available during sleep.*/
  352.     UInt32                             sleepPowerNeeded;            /* Milliwatts needed during sleep.*/
  353.     UInt32                             minimumWakeTime;            /* Minimum seconds before sleeping again.*/
  354.     ItemCount                         deviceCount;                /* Number of device power info records.*/
  355.     DevicePowerInfo                 devices[1];                    /* Array of device power info records.*/
  356. };
  357. typedef struct PowerSummary                PowerSummary;
  358. enum {
  359.                                                                 /* SleepQRec.sleepQFlags */
  360.     noCalls                        = 1,
  361.     noRequest                    = 2,
  362.     slpQType                    = 16,
  363.     sleepQType                    = 16
  364. };
  365.  
  366. /* Power Mgt Apple Event types and errors */
  367. enum {
  368.                                                                 /* power mgt class*/
  369.     kAEMacPowerMgtEvt            = FOUR_CHAR_CODE('pmgt'),        /* event ids*/
  370.     kAEMacToWake                = FOUR_CHAR_CODE('wake'),
  371.     kAEMacLowPowerSaveData        = FOUR_CHAR_CODE('pmsd'),
  372.     kAEMacEmergencySleep        = FOUR_CHAR_CODE('emsl'),
  373.     kAEMacEmergencyShutdown        = FOUR_CHAR_CODE('emsd')
  374. };
  375.  
  376. /* New Power Mgr Results*/
  377. enum {
  378.     kPowerHandlerExistsForDeviceErr = -13006,
  379.     kPowerHandlerNotFoundForDeviceErr = -13007,
  380.     kPowerHandlerNotFoundForProcErr = -13008,
  381.     kPowerMgtMessageNotHandled    = -13009,
  382.     kPowerMgtRequestDenied        = -13010,
  383.     kCantReportProcessorTemperatureErr = -13013,
  384.     kProcessorTempRoutineRequiresMPLib2 = -13014,
  385.     kNoSuchPowerSource            = -13020
  386. };
  387.  
  388.  
  389. /*
  390.    These are result values returned by a Power Handler when queries
  391.    by the Power Mgr if the device which that Power Handler represents
  392.    woke the machine.
  393. */
  394. enum {
  395.     kDeviceDidNotWakeMachine    = 0,                            /* device did NOT wake machine*/
  396.     kDeviceRequestsFullWake        = 1,                            /* device did wake machine and requests full wakeup*/
  397.     kDeviceRequestsWakeToDoze    = 2                                /* device did wake machine and requests partial wakeup*/
  398. };
  399.  
  400. /* bits in bitfield returned by PMFeatures */
  401. enum {
  402.     hasWakeupTimer                = 0,                            /* 1=wakeup timer is supported                                */
  403.     hasSharedModemPort            = 1,                            /* 1=modem port shared by SCC and internal modem            */
  404.     hasProcessorCycling            = 2,                            /* 1=processor cycling is supported                            */
  405.     mustProcessorCycle            = 3,                            /* 1=processor cycling should not be turned off                */
  406.     hasReducedSpeed                = 4,                            /* 1=processor can be started up at reduced speed            */
  407.     dynamicSpeedChange            = 5,                            /* 1=processor speed can be switched dynamically            */
  408.     hasSCSIDiskMode                = 6,                            /* 1=SCSI Disk Mode is supported                            */
  409.     canGetBatteryTime            = 7,                            /* 1=battery time can be calculated                            */
  410.     canWakeupOnRing                = 8,                            /* 1=can wakeup when the modem detects a ring                */
  411.     hasDimmingSupport            = 9,                            /* 1=has dimming support built in (DPMS standby by default)    */
  412.     hasStartupTimer                = 10,                            /* 1=startup timer is supported                                */
  413.     hasChargeNotification        = 11,                            /* 1=client can determine of charge connect status change notifications available */
  414.     hasDimSuspendSupport        = 12                            /* 1=supports dimming LCD and CRT to DPMS suspend state        */
  415. };
  416.  
  417. /* more bits in bitfield returned by PMFeatures to be merged with above when time */
  418. enum {
  419.     hasWakeOnNetActivity        = 13,                            /* 1=hardware supports wake on network activity                */
  420.     hasWakeOnLid                = 14,                            /* 1=hardware can wake when opened                            */
  421.     canPowerOffPCIBus            = 15,                            /* 1=hardware can power off PCI bus during sleep if cards allow */
  422.     hasDeepSleep                = 16,                            /* 1=hardware supports deep sleep (hibernation) mode        */
  423.     hasSleep                    = 17                            /* 1=hardware supports normal (PowerBook-like) sleep        */
  424. };
  425.  
  426. /* bits in bitfield returned by GetIntModemInfo and set by SetIntModemState */
  427. enum {
  428.     hasInternalModem            = 0,                            /* 1=internal modem installed                        */
  429.     intModemRingDetect            = 1,                            /* 1=internal modem has detected a ring                */
  430.     intModemOffHook                = 2,                            /* 1=internal modem is off hook                        */
  431.     intModemRingWakeEnb            = 3,                            /* 1=wakeup on ring is enabled                        */
  432.     extModemSelected            = 4,                            /* 1=external modem selected                        */
  433.     modemSetBit                    = 15                            /* 1=set bit, 0=clear bit (SetIntModemState)        */
  434. };
  435.  
  436. /* bits in BatteryInfo.flags                                     */
  437. /* ("chargerConnected" doesn't mean the charger is plugged in)    */
  438. enum {
  439.     batteryInstalled            = 7,                            /* 1=battery is currently connected                    */
  440.     batteryCharging                = 6,                            /* 1=battery is being charged                        */
  441.     chargerConnected            = 5                                /* 1=charger is connected to the PowerBook            */
  442. };
  443.  
  444. enum {
  445.     HDPwrQType                    = 0x4844,                        /* 'HD' hard disk spindown queue element type        */
  446.     PMgrStateQType                = 0x504D                        /* 'PM' Power Manager state queue element type        */
  447. };
  448.  
  449. /* client notification bits in PMgrQueueElement.pmNotifyBits */
  450. enum {
  451.     pmSleepTimeoutChanged        = 0,
  452.     pmSleepEnableChanged        = 1,
  453.     pmHardDiskTimeoutChanged    = 2,
  454.     pmHardDiskSpindownChanged    = 3,
  455.     pmDimmingTimeoutChanged        = 4,
  456.     pmDimmingEnableChanged        = 5,
  457.     pmDiskModeAddressChanged    = 6,
  458.     pmProcessorCyclingChanged    = 7,
  459.     pmProcessorSpeedChanged        = 8,
  460.     pmWakeupTimerChanged        = 9,
  461.     pmStartupTimerChanged        = 10,
  462.     pmHardDiskPowerRemovedbyUser = 11,
  463.     pmChargeStatusChanged        = 12,
  464.     pmPowerLevelChanged            = 13,
  465.     pmWakeOnNetActivityChanged    = 14
  466. };
  467.  
  468. enum {
  469.     pmSleepTimeoutChangedMask    = (1 << pmSleepTimeoutChanged),
  470.     pmSleepEnableChangedMask    = (1 << pmSleepEnableChanged),
  471.     pmHardDiskTimeoutChangedMask = (1 << pmHardDiskTimeoutChanged),
  472.     pmHardDiskSpindownChangedMask = (1 << pmHardDiskSpindownChanged),
  473.     pmDimmingTimeoutChangedMask    = (1 << pmDimmingTimeoutChanged),
  474.     pmDimmingEnableChangedMask    = (1 << pmDimmingEnableChanged),
  475.     pmDiskModeAddressChangedMask = (1 << pmDiskModeAddressChanged),
  476.     pmProcessorCyclingChangedMask = (1 << pmProcessorCyclingChanged),
  477.     pmProcessorSpeedChangedMask    = (1 << pmProcessorSpeedChanged),
  478.     pmWakeupTimerChangedMask    = (1 << pmWakeupTimerChanged),
  479.     pmStartupTimerChangedMask    = (1 << pmStartupTimerChanged),
  480.     pmHardDiskPowerRemovedbyUserMask = (1 << pmHardDiskPowerRemovedbyUser),
  481.     pmChargeStatusChangedMask    = (1 << pmChargeStatusChanged),
  482.     pmPowerLevelChangedMask        = (1 << pmPowerLevelChanged),
  483.     pmWakeOnNetActivityChangedMask = (1 << pmWakeOnNetActivityChanged)
  484. };
  485.  
  486. /* System Activity Selectors */
  487. enum {
  488.     OverallAct                    = 0,                            /* general type of activity                            */
  489.     UsrActivity                    = 1,                            /* user specific type of activity                    */
  490.     NetActivity                    = 2,                            /* network specific activity                        */
  491.     HDActivity                    = 3                                /* Hard Drive activity                                */
  492. };
  493.  
  494. /* Storage Media sleep mode defines */
  495. enum {
  496.     kMediaModeOn                = 0,                            /* Media active (Drive spinning and at full power)    */
  497.     kMediaModeStandBy            = 1,                            /* Media standby (not implemented)    */
  498.     kMediaModeSuspend            = 2,                            /* Media Idle (not implemented)    */
  499.     kMediaModeOff                = 3                                /* Media Sleep (Drive not spinning and at min power, max recovery time)    */
  500. };
  501.  
  502. enum {
  503.     kMediaPowerCSCode            = 70
  504. };
  505.  
  506.  
  507. /* definitions for HDQueueElement.hdFlags    */
  508. enum {
  509.     kHDQueuePostBit                = 0,                            /* 1 = call this routine on the second pass        */
  510.     kHDQueuePostMask            = (1 << kHDQueuePostBit)
  511. };
  512.  
  513.  
  514. struct ActivityInfo {
  515.     short                             ActivityType;                /* Type of activity to be fetched.  Same as UpdateSystemActivity Selectors */
  516.     unsigned long                     ActivityTime;                /* Time of last activity (in ticks) of specified type. */
  517. };
  518. typedef struct ActivityInfo                ActivityInfo;
  519. /* information returned by GetScaledBatteryInfo */
  520.  
  521. struct BatteryInfo {
  522.     UInt8                             flags;                        /* misc flags (see below)                            */
  523.     UInt8                             warningLevel;                /* scaled warning level (0-255)                        */
  524.     UInt8                             reserved;                    /* reserved for internal use                        */
  525.     UInt8                             batteryLevel;                /* scaled battery level (0-255)                        */
  526. };
  527. typedef struct BatteryInfo                BatteryInfo;
  528.  
  529. typedef SInt8                             ModemByte;
  530. typedef SInt8                             BatteryByte;
  531. typedef SInt8                             SoundMixerByte;
  532. typedef long                             PMResultCode;
  533. typedef struct SleepQRec                 SleepQRec;
  534. typedef SleepQRec *                        SleepQRecPtr;
  535. typedef struct HDQueueElement             HDQueueElement;
  536. typedef struct PMgrQueueElement         PMgrQueueElement;
  537. typedef CALLBACK_API( long , SleepQProcPtr )(long message, SleepQRecPtr qRecPtr);
  538. /*
  539.     WARNING: SleepQProcPtr uses register based parameters under classic 68k
  540.              and cannot be written in a high-level language without 
  541.              the help of mixed mode or assembly glue.
  542. */
  543. typedef CALLBACK_API( void , HDSpindownProcPtr )(HDQueueElement *theElement);
  544. typedef CALLBACK_API( void , PMgrStateChangeProcPtr )(PMgrQueueElement *theElement, long stateBits);
  545. typedef REGISTER_UPP_TYPE(SleepQProcPtr)                         SleepQUPP;
  546. typedef STACK_UPP_TYPE(HDSpindownProcPtr)                         HDSpindownUPP;
  547. typedef STACK_UPP_TYPE(PMgrStateChangeProcPtr)                     PMgrStateChangeUPP;
  548.  
  549. struct SleepQRec {
  550.     SleepQRecPtr                     sleepQLink;                    /* pointer to next queue element                */
  551.     short                             sleepQType;                    /* queue element type (must be SleepQType)        */
  552.     SleepQUPP                         sleepQProc;                    /* pointer to sleep universal proc ptr            */
  553.     short                             sleepQFlags;                /* flags                                        */
  554. };
  555.  
  556.  
  557. struct HDQueueElement {
  558.     struct HDQueueElement *            hdQLink;                    /* pointer to next queue element                */
  559.     short                             hdQType;                    /* queue element type (must be HDPwrQType)        */
  560.     short                             hdFlags;                    /* miscellaneous flags                            */
  561.     HDSpindownUPP                     hdProc;                        /* pointer to routine to call                    */
  562.     long                             hdUser;                        /* user-defined (variable storage, etc.)        */
  563. };
  564.  
  565.  
  566. struct PMgrQueueElement {
  567.     struct PMgrQueueElement *        pmQLink;                    /* pointer to next queue element                */
  568.     short                             pmQType;                    /* queue element type (must be PMgrStateQType)    */
  569.     short                             pmFlags;                    /* miscellaneous flags                            */
  570.     long                             pmNotifyBits;                /* bitmap of which changes to be notified for    */
  571.     PMgrStateChangeUPP                 pmProc;                        /* pointer to routine to call                    */
  572.     long                             pmUser;                        /* user-defined (variable storage, etc.)        */
  573. };
  574.  
  575.  
  576.  
  577. struct BatteryTimeRec {
  578.     unsigned long                     expectedBatteryTime;        /* estimated battery time remaining (seconds)    */
  579.     unsigned long                     minimumBatteryTime;            /* minimum battery time remaining (seconds)        */
  580.     unsigned long                     maximumBatteryTime;            /* maximum battery time remaining (seconds)        */
  581.     unsigned long                     timeUntilCharged;            /* time until battery is fully charged (seconds)*/
  582. };
  583. typedef struct BatteryTimeRec            BatteryTimeRec;
  584.  
  585.  
  586. struct WakeupTime {
  587.     unsigned long                     wakeTime;                    /* wakeup time (same format as current time)        */
  588.     Boolean                         wakeEnabled;                /* 1=enable wakeup timer, 0=disable wakeup timer    */
  589.     SInt8                             filler;
  590. };
  591. typedef struct WakeupTime                WakeupTime;
  592.  
  593.  
  594. struct StartupTime {
  595.     unsigned long                     startTime;                    /* startup time (same format as current time)        */
  596.     Boolean                         startEnabled;                /* 1=enable startup timer, 0=disable startup timer    */
  597.     SInt8                             filler;
  598. };
  599. typedef struct StartupTime                StartupTime;
  600. /* PowerSource version*/
  601. enum {
  602.     kVersionOnePowerSource        = 1
  603. };
  604.  
  605. /* PowerSourceAttrs bits*/
  606.  
  607. enum {
  608.     bSourceIsBattery            = 0,                            /* power source is battery*/
  609.     bSourceIsAC                    = 1,                            /* power source is AC*/
  610.     bSourceCanBeCharged            = 2,                            /* power source can be charged*/
  611.     bSourceIsUPS                = 3,                            /* power source is UPS. NOTE: software should set bSourceIsBattery and bSourceIsAC also, as appropriate*/
  612.     kSourceIsBatteryMask        = (1 << bSourceIsBattery),
  613.     kSourceIsACMask                = (1 << bSourceIsAC),
  614.     kSourceCanBeChargedMask        = (1 << bSourceCanBeCharged),
  615.     kSourceIsUPSMask            = (1 << bSourceIsUPS)
  616. };
  617.  
  618. /* PowerSourceFlags bits*/
  619.  
  620. enum {
  621.     bSourceIsAvailable            = 0,                            /* power source is installed*/
  622.     bSourceIsCharging            = 1,                            /* power source being charged*/
  623.     bChargerIsAttached            = 2,                            /* a charger is connected*/
  624.     kSourceIsAvailableMask        = (1 << bSourceIsAvailable),
  625.     kSourceIsChargingMask        = (1 << bSourceIsCharging),
  626.     kChargerIsAttachedMask        = (1 << bChargerIsAttached)
  627. };
  628.  
  629. /* Power Capacity Types*/
  630.  
  631. enum {
  632.     kCapacityIsActual            = 0,                            /* current capacity is expessed as actual capacity in same units as max*/
  633.     kCapacityIsPercentOfMax        = 1                                /* current capacity is expressed as a percentage of maximumCapacity*/
  634. };
  635.  
  636. /* Net Activity Wake Options*/
  637. enum {
  638.     kConfigSupportsWakeOnNetBit    = 0,
  639.     kWakeOnNetAdminAccessesBit    = 1,
  640.     kWakeOnAllNetAccessesBit    = 2,
  641.     kUnmountServersBeforeSleepingBit = 3,
  642.     kConfigSupportsWakeOnNetMask = (1 << kConfigSupportsWakeOnNetBit),
  643.     kWakeOnNetAdminAccessesMask    = (1 << kWakeOnNetAdminAccessesBit),
  644.     kWakeOnAllNetAccessesMask    = (1 << kWakeOnAllNetAccessesBit),
  645.     kUnmountServersBeforeSleepingMask = (1 << kUnmountServersBeforeSleepingBit)
  646. };
  647.  
  648. /* Power Source capacity usage types*/
  649. enum {
  650.     kCurrentCapacityIsActualValue = 0,                            /* currentCapacity is a real value in same units as maxCapacity*/
  651.     kCurrentCapacityIsPercentOfMax = 1                            /* currentCapacity is expressed as a percentage of maxCapacity.*/
  652. };
  653.  
  654.  
  655. typedef SInt16                             PowerSourceID;
  656.  
  657. struct PowerSourceParamBlock {
  658.     PowerSourceID                     sourceID;                    /* unique id assigned by Power Mgr*/
  659.     UInt16                             sourceCapacityUsage;        /* how currentCapacity is used*/
  660.     UInt32                             sourceVersion;                /* version of this record*/
  661.     OptionBits                         sourceAttr;                    /* attribute flags (see below)*/
  662.     OptionBits                         sourceState;                /* state flags (see below)*/
  663.     UInt32                             currentCapacity;            /* current capacity, in*/
  664.                                                                 /*   milliwatts*/
  665.     UInt32                             maxCapacity;                /* full capacity, in milliwatts*/
  666.     UInt32                             timeRemaining;                /* time left to deplete, */
  667.                                                                 /*   in milliwatt-hours*/
  668.     UInt32                             timeToFullCharge;            /* time to charge, */
  669.                                                                 /*   in milliwatt-hours*/
  670.     UInt32                             voltage;                    /* voltage in millivolts*/
  671.     SInt32                             current;                    /* current in milliamperes */
  672.                                                                 /*  (negative if consuming, */
  673.                                                                 /*   positive if charging)*/
  674. };
  675. typedef struct PowerSourceParamBlock    PowerSourceParamBlock;
  676. typedef PowerSourceParamBlock *            PowerSourceParamBlockPtr;
  677. EXTERN_API( OSErr )
  678. DisableWUTime                    (void);
  679.  
  680. EXTERN_API( OSErr )
  681. SetWUTime                        (long                     wuTime);
  682.  
  683. EXTERN_API( OSErr )
  684. GetWUTime                        (long *                    wuTime,
  685.                                  Byte *                    wuFlag);
  686.  
  687. EXTERN_API( OSErr )
  688. BatteryStatus                    (Byte *                    status,
  689.                                  Byte *                    power);
  690.  
  691. EXTERN_API( OSErr )
  692. ModemStatus                        (Byte *                    status);
  693.  
  694.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  695.                                                                                             #pragma parameter __D0 IdleUpdate
  696.                                                                                             #endif
  697. EXTERN_API( long )
  698. IdleUpdate                        (void)                                                        ONEWORDINLINE(0xA285);
  699.  
  700.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  701.                                                                                             #pragma parameter __D0 GetCPUSpeed
  702.                                                                                             #endif
  703. EXTERN_API( long )
  704. GetCPUSpeed                        (void)                                                        TWOWORDINLINE(0x70FF, 0xA485);
  705.  
  706. EXTERN_API( void )
  707. EnableIdle                        (void)                                                        TWOWORDINLINE(0x7000, 0xA485);
  708.  
  709. EXTERN_API( void )
  710. DisableIdle                        (void)                                                        TWOWORDINLINE(0x7001, 0xA485);
  711.  
  712.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  713.                                                                                             #pragma parameter SleepQInstall(__A0)
  714.                                                                                             #endif
  715. EXTERN_API( void )
  716. SleepQInstall                    (SleepQRecPtr             qRecPtr)                            ONEWORDINLINE(0xA28A);
  717.  
  718.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  719.                                                                                             #pragma parameter SleepQRemove(__A0)
  720.                                                                                             #endif
  721. EXTERN_API( void )
  722. SleepQRemove                    (SleepQRecPtr             qRecPtr)                            ONEWORDINLINE(0xA48A);
  723.  
  724. EXTERN_API( void )
  725. AOn                                (void)                                                        TWOWORDINLINE(0x7004, 0xA685);
  726.  
  727. EXTERN_API( void )
  728. AOnIgnoreModem                    (void)                                                        TWOWORDINLINE(0x7005, 0xA685);
  729.  
  730. EXTERN_API( void )
  731. BOn                                (void)                                                        TWOWORDINLINE(0x7000, 0xA685);
  732.  
  733. EXTERN_API( void )
  734. AOff                            (void)                                                        TWOWORDINLINE(0x7084, 0xA685);
  735.  
  736. EXTERN_API( void )
  737. BOff                            (void)                                                        TWOWORDINLINE(0x7080, 0xA685);
  738.  
  739.  
  740. /* Public Power Management API  */
  741.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  742.                                                                                             #pragma parameter __D0 PMSelectorCount
  743.                                                                                             #endif
  744. EXTERN_API( short )
  745. PMSelectorCount                    (void)                                                        TWOWORDINLINE(0x7000, 0xA09E);
  746.  
  747.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  748.                                                                                             #pragma parameter __D0 PMFeatures
  749.                                                                                             #endif
  750. EXTERN_API( UInt32 )
  751. PMFeatures                        (void)                                                        TWOWORDINLINE(0x7001, 0xA09E);
  752.  
  753.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  754.                                                                                             #pragma parameter __D0 GetSleepTimeout
  755.                                                                                             #endif
  756. EXTERN_API( UInt8 )
  757. GetSleepTimeout                    (void)                                                        TWOWORDINLINE(0x7002, 0xA09E);
  758.  
  759.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  760.                                                                                             #pragma parameter SetSleepTimeout(__D0)
  761.                                                                                             #endif
  762. EXTERN_API( void )
  763. SetSleepTimeout                    (UInt8                     timeout)                            FOURWORDINLINE(0x4840, 0x303C, 0x0003, 0xA09E);
  764.  
  765.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  766.                                                                                             #pragma parameter __D0 GetHardDiskTimeout
  767.                                                                                             #endif
  768. EXTERN_API( UInt8 )
  769. GetHardDiskTimeout                (void)                                                        TWOWORDINLINE(0x7004, 0xA09E);
  770.  
  771.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  772.                                                                                             #pragma parameter SetHardDiskTimeout(__D0)
  773.                                                                                             #endif
  774. EXTERN_API( void )
  775. SetHardDiskTimeout                (UInt8                     timeout)                            FOURWORDINLINE(0x4840, 0x303C, 0x0005, 0xA09E);
  776.  
  777.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  778.                                                                                             #pragma parameter __D0 HardDiskPowered
  779.                                                                                             #endif
  780. EXTERN_API( Boolean )
  781. HardDiskPowered                    (void)                                                        TWOWORDINLINE(0x7006, 0xA09E);
  782.  
  783.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  784.                                                                                             #pragma parameter SpinDownHardDisk
  785.                                                                                             #endif
  786. EXTERN_API( void )
  787. SpinDownHardDisk                (void)                                                        TWOWORDINLINE(0x7007, 0xA09E);
  788.  
  789.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  790.                                                                                             #pragma parameter __D0 IsSpindownDisabled
  791.                                                                                             #endif
  792. EXTERN_API( Boolean )
  793. IsSpindownDisabled                (void)                                                        TWOWORDINLINE(0x7008, 0xA09E);
  794.  
  795.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  796.                                                                                             #pragma parameter SetSpindownDisable(__D0)
  797.                                                                                             #endif
  798. EXTERN_API( void )
  799. SetSpindownDisable                (Boolean                 setDisable)                            FOURWORDINLINE(0x4840, 0x303C, 0x0009, 0xA09E);
  800.  
  801.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  802.                                                                                             #pragma parameter __D0 HardDiskQInstall(__A0)
  803.                                                                                             #endif
  804. EXTERN_API( OSErr )
  805. HardDiskQInstall                (HDQueueElement *        theElement)                            TWOWORDINLINE(0x700A, 0xA09E);
  806.  
  807.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  808.                                                                                             #pragma parameter __D0 HardDiskQRemove(__A0)
  809.                                                                                             #endif
  810. EXTERN_API( OSErr )
  811. HardDiskQRemove                    (HDQueueElement *        theElement)                            TWOWORDINLINE(0x700B, 0xA09E);
  812.  
  813.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  814.                                                                                             #pragma parameter GetScaledBatteryInfo(__D0, __A0)
  815.                                                                                             #endif
  816. EXTERN_API( void )
  817. GetScaledBatteryInfo            (short                     whichBattery,
  818.                                  BatteryInfo *            theInfo)                            FIVEWORDINLINE(0x4840, 0x303C, 0x000C, 0xA09E, 0x2080);
  819.  
  820.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  821.                                                                                             #pragma parameter AutoSleepControl(__D0)
  822.                                                                                             #endif
  823. EXTERN_API( void )
  824. AutoSleepControl                (Boolean                 enableSleep)                        FOURWORDINLINE(0x4840, 0x303C, 0x000D, 0xA09E);
  825.  
  826.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  827.                                                                                             #pragma parameter __D0 GetIntModemInfo
  828.                                                                                             #endif
  829. EXTERN_API( UInt32 )
  830. GetIntModemInfo                    (void)                                                        TWOWORDINLINE(0x700E, 0xA09E);
  831.  
  832.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  833.                                                                                             #pragma parameter SetIntModemState(__D0)
  834.                                                                                             #endif
  835. EXTERN_API( void )
  836. SetIntModemState                (short                     theState)                            FOURWORDINLINE(0x4840, 0x303C, 0x000F, 0xA09E);
  837.  
  838.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  839.                                                                                             #pragma parameter __D0 MaximumProcessorSpeed
  840.                                                                                             #endif
  841. EXTERN_API( short )
  842. MaximumProcessorSpeed            (void)                                                        TWOWORDINLINE(0x7010, 0xA09E);
  843.  
  844.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  845.                                                                                             #pragma parameter __D0 CurrentProcessorSpeed
  846.                                                                                             #endif
  847. EXTERN_API( short )
  848. CurrentProcessorSpeed            (void)                                                        TWOWORDINLINE(0x7011, 0xA09E);
  849.  
  850.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  851.                                                                                             #pragma parameter __D0 FullProcessorSpeed
  852.                                                                                             #endif
  853. EXTERN_API( Boolean )
  854. FullProcessorSpeed                (void)                                                        TWOWORDINLINE(0x7012, 0xA09E);
  855.  
  856.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  857.                                                                                             #pragma parameter __D0 SetProcessorSpeed(__D0)
  858.                                                                                             #endif
  859. EXTERN_API( Boolean )
  860. SetProcessorSpeed                (Boolean                 fullSpeed)                            FOURWORDINLINE(0x4840, 0x303C, 0x0013, 0xA09E);
  861.  
  862.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  863.                                                                                             #pragma parameter __D0 GetSCSIDiskModeAddress
  864.                                                                                             #endif
  865. EXTERN_API( short )
  866. GetSCSIDiskModeAddress            (void)                                                        TWOWORDINLINE(0x7014, 0xA09E);
  867.  
  868.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  869.                                                                                             #pragma parameter SetSCSIDiskModeAddress(__D0)
  870.                                                                                             #endif
  871. EXTERN_API( void )
  872. SetSCSIDiskModeAddress            (short                     scsiAddress)                        FOURWORDINLINE(0x4840, 0x303C, 0x0015, 0xA09E);
  873.  
  874.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  875.                                                                                             #pragma parameter GetWakeupTimer(__A0)
  876.                                                                                             #endif
  877. EXTERN_API( void )
  878. GetWakeupTimer                    (WakeupTime *            theTime)                            TWOWORDINLINE(0x7016, 0xA09E);
  879.  
  880.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  881.                                                                                             #pragma parameter SetWakeupTimer(__A0)
  882.                                                                                             #endif
  883. EXTERN_API( void )
  884. SetWakeupTimer                    (WakeupTime *            theTime)                            TWOWORDINLINE(0x7017, 0xA09E);
  885.  
  886.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  887.                                                                                             #pragma parameter __D0 IsProcessorCyclingEnabled
  888.                                                                                             #endif
  889. EXTERN_API( Boolean )
  890. IsProcessorCyclingEnabled        (void)                                                        TWOWORDINLINE(0x7018, 0xA09E);
  891.  
  892.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  893.                                                                                             #pragma parameter EnableProcessorCycling(__D0)
  894.                                                                                             #endif
  895. EXTERN_API( void )
  896. EnableProcessorCycling            (Boolean                 enable)                                FOURWORDINLINE(0x4840, 0x303C, 0x0019, 0xA09E);
  897.  
  898.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  899.                                                                                             #pragma parameter __D0 BatteryCount
  900.                                                                                             #endif
  901. EXTERN_API( short )
  902. BatteryCount                    (void)                                                        TWOWORDINLINE(0x701A, 0xA09E);
  903.  
  904.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  905.                                                                                             #pragma parameter __D0 GetBatteryVoltage(__D0)
  906.                                                                                             #endif
  907. EXTERN_API( Fixed )
  908. GetBatteryVoltage                (short                     whichBattery)                        FOURWORDINLINE(0x4840, 0x303C, 0x001B, 0xA09E);
  909.  
  910.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  911.                                                                                             #pragma parameter GetBatteryTimes(__D0, __A0)
  912.                                                                                             #endif
  913. EXTERN_API( void )
  914. GetBatteryTimes                    (short                     whichBattery,
  915.                                  BatteryTimeRec *        theTimes)                            FOURWORDINLINE(0x4840, 0x303C, 0x001C, 0xA09E);
  916.  
  917.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  918.                                                                                             #pragma parameter __D0 GetDimmingTimeout
  919.                                                                                             #endif
  920. EXTERN_API( UInt8 )
  921. GetDimmingTimeout                (void)                                                        TWOWORDINLINE(0x701D, 0xA09E);
  922.  
  923.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  924.                                                                                             #pragma parameter SetDimmingTimeout(__D0)
  925.                                                                                             #endif
  926. EXTERN_API( void )
  927. SetDimmingTimeout                (UInt8                     timeout)                            FOURWORDINLINE(0x4840, 0x303C, 0x001E, 0xA09E);
  928.  
  929.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  930.                                                                                             #pragma parameter DimmingControl(__D0)
  931.                                                                                             #endif
  932. EXTERN_API( void )
  933. DimmingControl                    (Boolean                 enableSleep)                        FOURWORDINLINE(0x4840, 0x303C, 0x001F, 0xA09E);
  934.  
  935.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  936.                                                                                             #pragma parameter __D0 IsDimmingControlDisabled
  937.                                                                                             #endif
  938. EXTERN_API( Boolean )
  939. IsDimmingControlDisabled        (void)                                                        TWOWORDINLINE(0x7020, 0xA09E);
  940.  
  941.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  942.                                                                                             #pragma parameter __D0 IsAutoSlpControlDisabled
  943.                                                                                             #endif
  944. EXTERN_API( Boolean )
  945. IsAutoSlpControlDisabled        (void)                                                        TWOWORDINLINE(0x7021, 0xA09E);
  946.  
  947.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  948.                                                                                             #pragma parameter __D0 PMgrStateQInstall(__A0)
  949.                                                                                             #endif
  950. EXTERN_API( OSErr )
  951. PMgrStateQInstall                (PMgrQueueElement *        theElement)                            TWOWORDINLINE(0x7022, 0xA09E);
  952.  
  953.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  954.                                                                                             #pragma parameter __D0 PMgrStateQRemove(__A0)
  955.                                                                                             #endif
  956. EXTERN_API( OSErr )
  957. PMgrStateQRemove                (PMgrQueueElement *        theElement)                            TWOWORDINLINE(0x7023, 0xA09E);
  958.  
  959.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  960.                                                                                             #pragma parameter __D0 UpdateSystemActivity(__D0)
  961.                                                                                             #endif
  962. EXTERN_API( OSErr )
  963. UpdateSystemActivity            (UInt8                     activity)                            FOURWORDINLINE(0x4840, 0x303C, 0x0024, 0xA09E);
  964.  
  965.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  966.                                                                                             #pragma parameter __D0 DelaySystemIdle
  967.                                                                                             #endif
  968. EXTERN_API( OSErr )
  969. DelaySystemIdle                    (void)                                                        TWOWORDINLINE(0x7025, 0xA09E);
  970.  
  971.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  972.                                                                                             #pragma parameter __D0 GetStartupTimer(__A0)
  973.                                                                                             #endif
  974. EXTERN_API( OSErr )
  975. GetStartupTimer                    (StartupTime *            theTime)                            TWOWORDINLINE(0x7026, 0xA09E);
  976.  
  977.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  978.                                                                                             #pragma parameter __D0 SetStartupTimer(__A0)
  979.                                                                                             #endif
  980. EXTERN_API( OSErr )
  981. SetStartupTimer                    (StartupTime *            theTime)                            TWOWORDINLINE(0x7027, 0xA09E);
  982.  
  983.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  984.                                                                                             #pragma parameter __D0 GetLastActivity(__A0)
  985.                                                                                             #endif
  986. EXTERN_API( OSErr )
  987. GetLastActivity                    (ActivityInfo *            theActivity)                        TWOWORDINLINE(0x7028, 0xA09E);
  988.  
  989.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  990.                                                                                             #pragma parameter __D0 GetSoundMixerState(__A0)
  991.                                                                                             #endif
  992. EXTERN_API( OSErr )
  993. GetSoundMixerState                (SoundMixerByte *        theSoundMixerByte)                    TWOWORDINLINE(0x7029, 0xA09E);
  994.  
  995.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  996.                                                                                             #pragma parameter __D0 SetSoundMixerState(__A0)
  997.                                                                                             #endif
  998. EXTERN_API( OSErr )
  999. SetSoundMixerState                (SoundMixerByte *        theSoundMixerByte)                    TWOWORDINLINE(0x702A, 0xA09E);
  1000.  
  1001.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1002.                                                                                             #pragma parameter __D0 GetDimSuspendState
  1003.                                                                                             #endif
  1004. EXTERN_API( Boolean )
  1005. GetDimSuspendState                (void)                                                        TWOWORDINLINE(0x702B, 0xA09E);
  1006.  
  1007.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1008.                                                                                             #pragma parameter SetDimSuspendState(__D0)
  1009.                                                                                             #endif
  1010. EXTERN_API( void )
  1011. SetDimSuspendState                (Boolean                 dimSuspendState)                    FOURWORDINLINE(0x4840, 0x303C, 0x002C, 0xA09E);
  1012.  
  1013.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1014.                                                                                             #pragma parameter __D0 GetCoreProcessorTemperature(__A0)
  1015.                                                                                             #endif
  1016. EXTERN_API( SInt32 )
  1017. GetCoreProcessorTemperature        (MPCpuID                 inCpuID)                            TWOWORDINLINE(0x702D, 0xA09E);
  1018.  
  1019.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1020.                                                                                             #pragma parameter __D0 GetWakeOnNetworkOptions
  1021.                                                                                             #endif
  1022. EXTERN_API( OptionBits )
  1023. GetWakeOnNetworkOptions            (void)                                                        TWOWORDINLINE(0x702E, 0xA09E);
  1024.  
  1025.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1026.                                                                                             #pragma parameter SetWakeOnNetworkOptions(__A0)
  1027.                                                                                             #endif
  1028. EXTERN_API( void )
  1029. SetWakeOnNetworkOptions            (OptionBits             inOptions)                            TWOWORDINLINE(0x702F, 0xA09E);
  1030.  
  1031.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1032.                                                                                             #pragma parameter __D0 AddPowerSource(__A0)
  1033.                                                                                             #endif
  1034. EXTERN_API( OSStatus )
  1035. AddPowerSource                    (PowerSourceParamBlock * ioPowerSource)                        TWOWORDINLINE(0x7030, 0xA09E);
  1036.  
  1037.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1038.                                                                                             #pragma parameter __D0 RemovePowerSource(__D0)
  1039.                                                                                             #endif
  1040. EXTERN_API( OSStatus )
  1041. RemovePowerSource                (PowerSourceID             inSourceID)                            FOURWORDINLINE(0x4840, 0x303C, 0x0031, 0xA09E);
  1042.  
  1043.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1044.                                                                                             #pragma parameter __D0 UpdatePowerSource(__A0)
  1045.                                                                                             #endif
  1046. EXTERN_API( OSStatus )
  1047. UpdatePowerSource                (PowerSourceParamBlock * ioSource)                            TWOWORDINLINE(0x7032, 0xA09E);
  1048.  
  1049. EXTERN_API( Boolean )
  1050. IsServerModeEnabled                (void)                                                        TWOWORDINLINE(0x7033, 0xA09E);
  1051.  
  1052. EXTERN_API( void )
  1053. EnableServerMode                (Boolean                 inEnable)                            FOURWORDINLINE(0x4840, 0x303C, 0x0034, 0xA09E);
  1054.  
  1055. /* Power Handler Management */
  1056. EXTERN_API_C( Boolean )
  1057. IsPCIPowerOffDisabled            (void);
  1058.  
  1059. EXTERN_API_C( void )
  1060. EnablePCIPowerOff                (Boolean                 inEnable);
  1061.  
  1062. EXTERN_API_C( OSStatus )
  1063. AddDevicePowerHandler            (RegEntryIDPtr             regEntryID,
  1064.                                  PowerHandlerProcPtr     handler,
  1065.                                  UInt32                 refCon,
  1066.                                  char *                    deviceType);
  1067.  
  1068. EXTERN_API_C( OSStatus )
  1069. RemoveDevicePowerHandler        (RegEntryIDPtr             regEntryID);
  1070.  
  1071. EXTERN_API_C( OSStatus )
  1072. RemoveDevicePowerHandlerForProc    (PowerHandlerProcPtr     proc);
  1073.  
  1074. EXTERN_API_C( OSStatus )
  1075. GetDevicePowerLevel                (RegEntryIDPtr             regEntryID,
  1076.                                  PowerLevel *            devicePowerLevel);
  1077.  
  1078. EXTERN_API_C( OSStatus )
  1079. SetDevicePowerLevel                (RegEntryIDPtr             regEntryID,
  1080.                                  PowerLevel             devicePowerLevel);
  1081.  
  1082.  
  1083. #if OPAQUE_UPP_TYPES
  1084.     EXTERN_API(SleepQUPP)
  1085.     NewSleepQUPP                   (SleepQProcPtr            userRoutine);
  1086.  
  1087.     EXTERN_API(HDSpindownUPP)
  1088.     NewHDSpindownUPP               (HDSpindownProcPtr        userRoutine);
  1089.  
  1090.     EXTERN_API(PMgrStateChangeUPP)
  1091.     NewPMgrStateChangeUPP           (PMgrStateChangeProcPtr    userRoutine);
  1092.  
  1093.     EXTERN_API(void)
  1094.     DisposeSleepQUPP               (SleepQUPP                userUPP);
  1095.  
  1096.     EXTERN_API(void)
  1097.     DisposeHDSpindownUPP           (HDSpindownUPP            userUPP);
  1098.  
  1099.     EXTERN_API(void)
  1100.     DisposePMgrStateChangeUPP       (PMgrStateChangeUPP        userUPP);
  1101.  
  1102.     EXTERN_API(long)
  1103.     InvokeSleepQUPP                   (long                    message,
  1104.                                     SleepQRecPtr            qRecPtr,
  1105.                                     SleepQUPP                userUPP);
  1106.  
  1107.     EXTERN_API(void)
  1108.     InvokeHDSpindownUPP               (HDQueueElement *        theElement,
  1109.                                     HDSpindownUPP            userUPP);
  1110.  
  1111.     EXTERN_API(void)
  1112.     InvokePMgrStateChangeUPP       (PMgrQueueElement *        theElement,
  1113.                                     long                    stateBits,
  1114.                                     PMgrStateChangeUPP        userUPP);
  1115.  
  1116. #else
  1117.     enum { uppSleepQProcInfo = 0x00131832 };                         /* register 4_bytes:D0 Func(4_bytes:D0, 4_bytes:A0) */
  1118.     enum { uppHDSpindownProcInfo = 0x000000C0 };                     /* pascal no_return_value Func(4_bytes) */
  1119.     enum { uppPMgrStateChangeProcInfo = 0x000003C0 };                 /* pascal no_return_value Func(4_bytes, 4_bytes) */
  1120.     #define NewSleepQUPP(userRoutine)                                 (SleepQUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSleepQProcInfo, GetCurrentArchitecture())
  1121.     #define NewHDSpindownUPP(userRoutine)                             (HDSpindownUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppHDSpindownProcInfo, GetCurrentArchitecture())
  1122.     #define NewPMgrStateChangeUPP(userRoutine)                         (PMgrStateChangeUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppPMgrStateChangeProcInfo, GetCurrentArchitecture())
  1123.     #define DisposeSleepQUPP(userUPP)                                 DisposeRoutineDescriptor(userUPP)
  1124.     #define DisposeHDSpindownUPP(userUPP)                             DisposeRoutineDescriptor(userUPP)
  1125.     #define DisposePMgrStateChangeUPP(userUPP)                         DisposeRoutineDescriptor(userUPP)
  1126.     #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1127.     #pragma parameter __D0 InvokeSleepQUPP(__D0, __A0, __A1)
  1128.     long InvokeSleepQUPP(long message, SleepQRecPtr qRecPtr, SleepQUPP userUPP) = 0x4E91;
  1129.     #else
  1130.         #define InvokeSleepQUPP(message, qRecPtr, userUPP)                 CALL_TWO_PARAMETER_UPP((userUPP), uppSleepQProcInfo, (message), (qRecPtr))
  1131.     #endif
  1132.     #define InvokeHDSpindownUPP(theElement, userUPP)                 CALL_ONE_PARAMETER_UPP((userUPP), uppHDSpindownProcInfo, (theElement))
  1133.     #define InvokePMgrStateChangeUPP(theElement, stateBits, userUPP)  CALL_TWO_PARAMETER_UPP((userUPP), uppPMgrStateChangeProcInfo, (theElement), (stateBits))
  1134. #endif
  1135. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  1136. #define NewSleepQProc(userRoutine)                                 NewSleepQUPP(userRoutine)
  1137. #define NewHDSpindownProc(userRoutine)                             NewHDSpindownUPP(userRoutine)
  1138. #define NewPMgrStateChangeProc(userRoutine)                     NewPMgrStateChangeUPP(userRoutine)
  1139. #define CallSleepQProc(userRoutine, message, qRecPtr)            InvokeSleepQUPP(message, qRecPtr, userRoutine)
  1140. #define CallHDSpindownProc(userRoutine, theElement)                InvokeHDSpindownUPP(theElement, userRoutine)
  1141. #define CallPMgrStateChangeProc(userRoutine, theElement, stateBits) InvokePMgrStateChangeUPP(theElement, stateBits, userRoutine)
  1142.  
  1143.  
  1144. #if PRAGMA_STRUCT_ALIGN
  1145.     #pragma options align=reset
  1146. #elif PRAGMA_STRUCT_PACKPUSH
  1147.     #pragma pack(pop)
  1148. #elif PRAGMA_STRUCT_PACK
  1149.     #pragma pack()
  1150. #endif
  1151.  
  1152. #ifdef PRAGMA_IMPORT_OFF
  1153. #pragma import off
  1154. #elif PRAGMA_IMPORT
  1155. #pragma import reset
  1156. #endif
  1157.  
  1158. #ifdef __cplusplus
  1159. }
  1160. #endif
  1161.  
  1162. #endif /* __POWER__ */
  1163.  
  1164.